<?php
/* 
 *包装
 */
class PackageAction extends CommonAction {
    //TODO
    public function _filter(&$map) {
        $key = trim($_REQUEST['keywords']);
        if(!empty($key)) {
            $map['note'] = array('like',"%".$key."%");//备注信息
            $map['title'] = array('like',"%".$key."%");//锚文本
            $map['webname'] = array('like',"%".$key."%");//网站名称
            $map['url'] = array('like',"%".$key."%");//url
            $map['_logic'] = "or";
        }
    }

    public function insert()
    {
        $count = count($_POST['pack_type']);
        $data = $_POST;
        for ($i=0; $i < $count; $i++) {
            if($data['pack_type'][$i] == '')
                continue;
            $_POST =array(
                'shipping_id' => $data['shipping_id'],
               'pack_type' => $data['pack_type'][$i],
               'pack_weight' => $data['pack_weight'][$i],
               'length' => $data['length'][$i],
               'width' => $data['width'][$i],
               'height' => $data['height'][$i],
               'pack_desc' => $data['pack_desc'][$i],
               'about_net_weight' => $data['about_net_weight'][$i]
               );
            $this->micro_insert();
            unset($_POST);

        }
        M('Shipping')->where('id = '.$data['shipping_id'])->setField('status',1); //打包完成，单据待制作
        $this->assign('jumpUrl',$_REQUEST['jumpUrl']);
        $this->success('打包完成！');
    }
}
?>
